<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<meta name="format-detection" content="telephone=no"/>
<meta name="wap-font-scale" content="no">
<meta name="renderer" content="webkit">
<title>AutoCode</title>
<link rel="shortcut icon" href="/favicon.ico" />
<script src="/links/jquery/jquery-3.5.1.min.js"></script>
<script src="/links/polyfill.min.js"></script>
<script src="/links/axios/axios.min.js"></script>
<script src="/links/vue/vue.min.js"></script>
<script src="/links/element-ui/index.js"></script>
<script src="/links/dayjs.min.js"></script>
<script src="/links/echarts/echarts.js"></script>
<script src="/links/JsBarcode.all.js"></script>
<script src="/links/qrcode.min.js"></script>
<script src="/links/layer/layer.js"></script>
<script src="/links/crypto/crypto-js.js"></script>
<script src="/js/dragController.js"></script>
<script src="/js/HttpApi.js"></script>
<script src="/js/AutoCode.js"></script>
<link href="/links/element-ui/theme/index.css" rel="stylesheet"/>
<link href="/css/default.css" rel="stylesheet"/>
<link href="/css/dragController.css" rel="stylesheet"/>
    <script src="/links/ace/src/ace.js"></script>
<script src="/links/ace/src/ext-language_tools.js"></script>
<link href="/links/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet" />
    <style>
        
    </style>
</head>
<body>
<div id="app"  class="box " >
<div class="left " style="width:400px;">
<div class="flex ac-tree-head ac-tree-head-default-line">
    <div class="ac-tree-title"></div>
    <div class="ac-tree-oper">
        <el-button size="medium"  v-if="menusTree.operVisible.buttonQ" @click="menusTree_load()" :disabled="menusTree.operDisabled.buttonQ"  type="text"     native-type="button">刷新(R)</el-button>
<el-button size="medium"  v-if="menusTree.operVisible.buttonA" @click="menusTree_openMenusAdd()" :disabled="menusTree.operDisabled.buttonA"  type="text"     native-type="button">添加(A)</el-button>

    </div>
</div>
<div style="padding:5px 10px;">
    <el-input size="mini" placeholder="输入关键字进行过滤" v-model="menusTree.filterValue"></el-input>
</div>
<div class="ac-tree-content2">
    <el-tree ref="menusTree" :data="menusTree.data"
    :expand-on-click-node="false" node-key="id" empty-text="内容为空"
    highlight-current :current-node-key="menusTree.currentNodeKey"  
       
    :filter-node-method="menusTree_filterNodeMethod"
      
    draggable :allow-drag="menusTree_allowDrag" :allow-drop="menusTree_allowDrop" @node-drop="menusTree_nodeDrop"
    
    @current-change="menusTree_currentChange"
    >
    <span class="custom-tree-node" slot-scope="{ node, data }">
    <span>
        <i class="el-icon-folder" v-if="data.menuType=='0'"></i>
        <i class="el-icon-folder" v-else-if="data.children  && data.children.length > 0 "></i>
        <i class="el-icon-document" v-else></i>
        {{ data.name }}
    </span>
    <span>
        <el-dropdown size="small" @command="menusTree_treeCommand">
            <el-link icon="el-icon-more"></el-link>
            <el-dropdown-menu slot="dropdown">
                <el-dropdown-item v-if="data.menuType=='0' || data.menuType=='1'" :command="{'flag':'addChildren','nodeData':data}">添加下级</el-dropdown-item>
                <el-dropdown-item v-if="!data.children || data.children.length==0" :command="{'flag':'del','nodeData':data}">删除</el-dropdown-item>
            </el-dropdown-menu>
        </el-dropdown>
    </span>
</span>
</el-tree>

</div>
</div>
<div class="resize"></div>
<div class="right " style="width:calc(100% - 402px);">
<div class="box"><div class="topBox " style="height:280px;">
 <div class="flex ac-form-head ac-form-head-default-line">
    <div class="ac-form-title"></div>
    <div class="ac-form-oper"><el-button size="medium"  v-if="menusInfo.operVisible.buttonC" @click="menusInfo_save()" :disabled="menusInfo.operDisabled.buttonC"  type="text"     native-type="button">保存</el-button>
</div>
</div>
<div class="ac-form-content">
    <el-form class="ac-el-form"    label-width="80px" label-position="right"
     size="mini" ref="menusInfo" :model="menusInfo.data" :rules="menusInfo.rules"  
     :disabled="menusInfo.disabled" @submit.native.prevent>
    <el-row><el-col :span=12 v-if="menusInfo.itemVisible.name">
    <el-form-item prop="name" label="菜单名称">
        
<el-input type="text" size="mini"  v-model="menusInfo.data.name" placeholder="菜单名称" :disabled="menusInfo.itemDisabled.name" @change="menusInfo_change('name',menusInfo.data)"   ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="menusInfo.itemVisible.icon">
     <el-form-item prop="icon" label="菜单图标">
    <el-input type="text" size="mini" v-model="menusInfo.data.icon" placeholder="菜单图标" @change="menusInfo_change('icon')">
        <template slot="append"> <i :class="['fa',menusInfo.data.icon]" aria-hidden="true"></i></template>
    </el-input>
</el-form-item>
</el-col>
<el-col :span=12 v-if="menusInfo.itemVisible.url">
    <el-form-item prop="url" label="菜单URL">
         <el-input type="text" size="mini" v-model="menusInfo.data.url" placeholder="菜单URL"  :disabled="menusInfo.itemDisabled.url" >
 <el-button slot="suffix" size="mini" type="text" icon="el-icon-edit" :disabled="menusInfo.itemDisabled.url" @click="menusInfo_editFuncTreeSelect('url',menusInfo.data)"></el-button>
 
 </el-input>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="menusInfo.itemVisible.internalOrExternal">
    <el-form-item prop="internalOrExternal" label="打开方式">
        <el-radio-group v-model="menusInfo.data.internalOrExternal" size="mini" :disabled="menusInfo.itemDisabled.internalOrExternal" @change="menusInfo_change('internalOrExternal',menusInfo.data)">
     <el-radio  label="0">内部链接</el-radio><el-radio  label="1">模板页面</el-radio><el-radio  label="2">外部链接</el-radio>
  </el-radio-group>

        
    </el-form-item>
</el-col>
<el-col :span=12 v-if="menusInfo.itemVisible.hasCalc">
     <el-form-item prop="hasCalc" label="计算文本">
    <el-checkbox v-model="menusInfo.data.hasCalc" true-label='Y' false-label='N'></el-checkbox>
    <el-button type="text" size="mini" v-if="menusInfo.data.hasCalc=='Y'" @click="menusInfo_editJavaEditor">设置计算文本</el-button>
</el-form-item>
</el-col>
<el-col :span=12 v-if="menusInfo.itemVisible.paramAceEditor">
     <el-form-item prop="paramAceEditor" label="请求参数">
    <el-button type="text" size="mini" @click="menusInfo_editJsonEditor">设置参数信息</el-button>
</el-form-item>
</el-col>
<el-col :span=8 v-if="menusInfo.itemVisible.isSystem">
    <el-form-item prop="isSystem" label="系统菜单">
        <el-checkbox  v-model="menusInfo.data.isSystem"  size="mini"  true-label="Y"  false-label="N" :disabled="menusInfo.itemDisabled.isSystem" @change="menusInfo_change('isSystem',menusInfo.data)" ></el-checkbox>

        
    </el-form-item>
</el-col>
<el-col :span=8 v-if="menusInfo.itemVisible.isManager">
    <el-form-item prop="isManager" label="管理员菜单">
        <el-checkbox  v-model="menusInfo.data.isManager"  size="mini"  true-label="Y"  false-label="N" :disabled="menusInfo.itemDisabled.isManager" @change="menusInfo_change('isManager',menusInfo.data)" ></el-checkbox>

        
    </el-form-item>
</el-col>
<el-col :span=8 v-if="menusInfo.itemVisible.isPublic">
    <el-form-item prop="isPublic" label="公共菜单">
        <el-checkbox  v-model="menusInfo.data.isPublic"  size="mini"  true-label="Y"  false-label="N" :disabled="menusInfo.itemDisabled.isPublic" @change="menusInfo_change('isPublic',menusInfo.data)" ></el-checkbox>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="menusInfo.itemVisible.showName">
    <el-form-item prop="showName" label="显示名称">
        
<el-input type="text" size="mini"  v-model="menusInfo.data.showName" placeholder="显示名称" :disabled="menusInfo.itemDisabled.showName" @change="menusInfo_change('showName',menusInfo.data)"   ></el-input>

        
    </el-form-item>
</el-col>
</el-row>
 </el-form>

</div>
</div>
<div class="move"></div>
<div class="downBox " style="height:calc(100% - 282px);">
<el-tabs type="border-card" v-model="page.tabs" class=""  >
<el-tab-pane class="" label="授权单位" name="tab2" :disabled="tabDisabled.tab2" v-if="tabVisible.tab2" >
<div class="flex ac-table-head">
    <div class="ac-table-oper"><el-button size="medium"  v-if="sysMenuOrgan.operVisible.add" @click="sysMenuOrgan_openSelectOrgan()" :disabled="sysMenuOrgan.operDisabled.add"  type="text"     native-type="button">添加(A)</el-button>
<el-button size="medium"  v-if="sysMenuOrgan.operVisible.del" @click="sysMenuOrgan_delete()" :disabled="sysMenuOrgan.operDisabled.del"  type="text"     native-type="button">删除(D)</el-button>
</div>
    <div></div>
</div>
<div class="ac-table-content2">
    <el-table row-key="id" highlight-current-row stripe show-header    border  
    :data="sysMenuOrgan.data" size="mini" ref="sysMenuOrgan"
       
    height="100%"
    @current-change="sysMenuOrgan_currentChange">
    <el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="orgCode" label="机构代码"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.orgCode}}
   </template>
</el-table-column>
<el-table-column prop="label" label="机构名称"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.label}}
   </template>
</el-table-column>
<el-table-column prop="orgType" label="机构类型"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.orgType}}
   </template>
</el-table-column>
<el-table-column prop="contact" label="联系人"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.contact}}
   </template>
</el-table-column>
<el-table-column prop="tel" label="电话"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.tel}}
   </template>
</el-table-column>
<el-table-column prop="email" label="邮箱"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.email}}
   </template>
</el-table-column>

</el-table>

</div>
<div class="flex">
    <div></div>
    <div> <el-pagination
      @size-change="sysMenuOrgan_pageSizeChange"
      @current-change="sysMenuOrgan_pageCurrentChange"
      :current-page="sysMenuOrgan.pagingData.currentPage"
      :page-sizes="sysMenuOrgan.pagingData.pageSizes"
      :page-size="sysMenuOrgan.pagingData.pageSize"
      layout="total, sizes, prev, pager, next"
      :total="sysMenuOrgan.pagingData.total"
       
      >
    </el-pagination>
</div>
</div>
</el-tab-pane>

</el-tabs>

</div>
</div>
</div>

<el-dialog :visible.sync="funcTreeSelect.visible" :title="funcTreeSelect.title"
            width="400px"
                
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;height:500px;">
                <div style="height:100%;overflow-y: auto;">
    <el-tree ref="funcTreeSelect" :data="funcTreeSelect.data"
    :expand-on-click-node="false" node-key="id" empty-text="内容为空"
    highlight-current :current-node-key="funcTreeSelect.currentNodeKey"  
    show-checkbox  :default-checked-keys="funcTreeSelect.defaultCheckedKeys" check-on-click-node
    
      
       
    @check="funcTreeSelect_check"
    @current-change="funcTreeSelect_currentChange"
    >
    <span class="custom-tree-node" slot-scope="{ node, data }">
    <span>
        <template v-if="data.type=='category'">{{ data.label }}</template>
        <template v-else-if="data.type=='application'">{{ data.code }}</template>
        <template v-else>{{ data.code }}【{{ data.label }}】</template>

    </span>
    <span>

    </span>
</span>
</el-tree>

</div>
            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="funcTreeSelect_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="funcTreeSelect_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="menusAdd.visible" :title="menusAdd.title"
            width="500px"
                
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;">
                <el-form class=""    label-width="80px" label-position="right"
     size="mini" ref="menusAdd" :model="menusAdd.data" :rules="menusAdd.rules"  
     :disabled="menusAdd.disabled" @submit.native.prevent>
    <el-row><el-col :span=24 v-if="menusAdd.itemVisible.name">
    <el-form-item prop="name" label="菜单名称">
        
<el-input type="text" size="mini"  v-model="menusAdd.data.name" placeholder="菜单名称" :disabled="menusAdd.itemDisabled.name"  @keyup.enter.native="menusAdd_dialogOk"  ></el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="menusAdd.itemVisible.url">
    <el-form-item prop="url" label="菜单URL">
         <el-input type="text" size="mini" v-model="menusAdd.data.url" placeholder="菜单URL"  :disabled="menusAdd.itemDisabled.url" readonly>
 <el-button slot="suffix" size="mini" type="text" icon="el-icon-edit" :disabled="menusAdd.itemDisabled.url" @click="menusAdd_editFuncTreeSelect('url',menusAdd.data)"></el-button>
 
 </el-input>

        
    </el-form-item>
</el-col>
<el-col :span=24 v-if="menusAdd.itemVisible.icon">
    <el-form-item prop="icon" label="菜单图标">
        
<el-input type="text" size="mini"  v-model="menusAdd.data.icon" placeholder="菜单图标" :disabled="menusAdd.itemDisabled.icon"  @keyup.enter.native="menusAdd_dialogOk"  ></el-input>

        <span class="ac-form-item-remark">菜单图标采用FontAwesome V4图标库</span>
    </el-form-item>
</el-col>
</el-row>
 </el-form>

            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="menusAdd_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="menusAdd_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="selectOrgan.visible" :title="selectOrgan.title"
            width="80%"
                
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div style="width:100%;height:400px;">
                <div class="ac-table-content">
    <el-table row-key="id" highlight-current-row stripe show-header    border  
    :data="selectOrgan.data" size="mini" ref="selectOrgan"
       
    height="100%"
    @current-change="selectOrgan_currentChange">
    <el-table-column type="selection" width="50" align="center"></el-table-column>
<el-table-column type="index" width="50" label="序号"></el-table-column>
<el-table-column prop="code" label="组织机构代码"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.code}}
   </template>
</el-table-column>
<el-table-column prop="label" label="组织机构名称"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.label}}
   </template>
</el-table-column>
<el-table-column prop="orgType" label="组织机构类型"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        <template v-for="dict in dictOptions.orgType" v-if="scope.row.orgType==dict.value"> <i :style="{color:dict.iconColor}" :class="dict.icon"></i> <label :style="{color:dict.fontColor}">{{dict.label}}</label></template>
   </template>
</el-table-column>
<el-table-column prop="contact" label="联系人"    align="left"   >
   <template slot-scope="scope">
        {{scope.row.contact}}
   </template>
</el-table-column>
<el-table-column prop="tel" label="电话"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.tel}}
   </template>
</el-table-column>
<el-table-column prop="email" label="邮箱"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.email}}
   </template>
</el-table-column>
<el-table-column prop="address" label="详细地址"    align="left"  show-overflow-tooltip >
   <template slot-scope="scope">
        {{scope.row.address}}
   </template>
</el-table-column>

</el-table>

</div>
<div class="flex">
    <div></div>
    <div> <el-pagination
      @size-change="selectOrgan_pageSizeChange"
      @current-change="selectOrgan_pageCurrentChange"
      :current-page="selectOrgan.pagingData.currentPage"
      :page-sizes="selectOrgan.pagingData.pageSizes"
      :page-size="selectOrgan.pagingData.pageSize"
      layout="total, sizes, prev, pager, next"
      :total="selectOrgan.pagingData.total"
       
      >
    </el-pagination>
</div>
</div>
            </div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="selectOrgan_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="selectOrgan_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="javaEditor.visible" :title="javaEditor.title"
            width="50%"
               
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div id="javaEditor" style="height:60vh;border: 1px solid #9f9f9f;"></div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="javaEditor_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="javaEditor_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="jsonEditor.visible" :title="jsonEditor.title"
            width="80%"
               
            :close-on-click-modal="false"
            :close-on-press-escape="false">
            <div id="jsonEditor" style="height:60vh;border: 1px solid #9f9f9f;"></div>
            <div class="dialog-footer" slot="footer">    <el-button size="mini" @click="jsonEditor_dialogOk()"  type="primary"      native-type="button">确 定</el-button>
    <el-button size="medium" @click="jsonEditor_dialogCancel()"  type="text"      native-type="button">取 消</el-button>
</div>
</el-dialog>


</div>

</body>
<script th:inline="javascript">
    let vm = new Vue({
            el: '#app',
            data() {
                return {"sysMenuOrgan":{"title":"授权组织机构","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{"currentPage":1,"total":0,"pageSize":20,"pageSizes":[10,20,30,40,50,100]},"operData":{},"operVisible":{"del":true,"add":true},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"menusInfo":{"title":"菜单信息","data":{"isSystem":"N","isManager":"N","isPublic":"N"},"operData":{},"operVisible":{"buttonC":true},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{"name":true,"hasCalc":true,"icon":true,"internalOrExternal":true,"paramAceEditor":true,"url":true,"isSystem":true,"isManager":true,"isPublic":true,"showName":true},"itemDisabled":{},"transfer":{},"rules":{"name":[{"required":true,"message":"请输入菜单名称","trigger":"blur"}]}},"menusTree":{"title":"菜单列表","data":[],"filterValue":"","defaultCheckedKeys":[],"currentNodeKey":{},"operData":{},"operVisible":{"buttonA":true,"buttonQ":true},"operDisabled":{},"currentRow":{}},"page":{"tabs":"tab2"},"tabDisabled":{"tab2":false},"tabVisible":{"tab2":true},"customOptions":{},"dictOptions":{},"funcTreeSelect":{"visible":false,"title":"功能选择","data":[],"defaultCheckedKeys":[],"currentNodeKey":{},"operData":{},"operVisible":{},"operDisabled":{},"currentRow":{}},"menusAdd":{"visible":false,"title":"添加菜单","data":{"icon":"fa-bookmark-o"},"operData":{},"operVisible":{},"operDisabled":{},"disabled":false,"editorForm":true,"itemVisible":{"url":true,"icon":true,"name":true},"itemDisabled":{},"transfer":{},"rules":{"name":[{"required":true,"message":"请输入菜单名称","trigger":"blur"}]}},"selectOrgan":{"visible":false,"title":"选择组织机构","currentRow":{},"data":[],"expandRowKeys":[],"pagingData":{"currentPage":1,"total":0,"pageSize":20,"pageSizes":[10,20,30,40,50,100]},"operData":{},"operVisible":{},"operDisabled":{},"rawData":[],"itemVisible":{},"operDialogVisible":false},"javaEditor":{"visible":false,"title":"菜单计算器注解名称","operData":{},"operVisible":{},"operDisabled":{},"data":[]},"jsonEditor":{"visible":false,"title":"json编辑器","operData":{},"operVisible":{},"operDisabled":{},"data":{}}}
            },
            watch: {
"menusTree.filterValue":function(val){
	this.$refs.menusTree.filter(val);
},
"menusInfo.data.url":function(newVal, oldVal) {
    if (this.menusInfo.data.id) {
        HttpApi.updateProvider("sysMenus", "url", this.menusInfo.data, function() {

        });
    }
}},
            methods: {
sysMenuOrgan_pageSizeChange:function(pageSize){
    this.sysMenuOrgan.pagingData.pageSize=pageSize;
    this.sysMenuOrgan_load();
}
,
funcTreeSelect_filterNodeMethod:function(value, data) {
    if (!value) return true;
	let lowValue = value.toLowerCase();
	return data.label.toLowerCase().includes(lowValue)  ||  data.code.toLowerCase().includes(lowValue);
},
sysMenuOrgan_openSelectOrgan:function() {
    let that = this;
    this.sysMenuOrgan.operData.menuType = "PC";
    this.selectOrgan_dialogOpen(this.sysMenuOrgan.operData, function(dialogData) {
        dialogData.forEach(function(item, index) {
            if (item.id) {
                delete item.id;
            }
            item.menuId = that.sysMenuOrgan.operData.menuId;
            item.orgCode = item.code;
        });
        HttpApi.saveBatchProvider("sysOrganMenu", dialogData, function(res) {
            that.selectOrgan.visible = false;
            that.sysMenuOrgan_load();
        });
    })
},
selectOrgan_pageCurrentChange:function(currentPage){
    this.selectOrgan.pagingData.currentPage=currentPage;
    this.selectOrgan_load();
}
,
selectOrgan_pageSizeChange:function(pageSize){
    this.selectOrgan.pagingData.pageSize=pageSize;
    this.selectOrgan_load();
}
,
menusTree_filterNodeMethod:function(value, data) {
    if (!value) return true;
    let lowValue = value.toLowerCase();
    return data.name.toLowerCase().indexOf(lowValue) !== -1;
},
menusInfo_save:function(param) {
    let that = this;
    delete this.menusInfo.data["calcName"];
    delete this.menusInfo.data["menuParam"];
    HttpApi.post2("/platform/menus/save", this.menusInfo.data, function(res) {
        that.$message.success("保存成功");
        /*请补充方法信息*/
    });
},
funcTreeSelect_dialogOk:function(){
       let checkedNodes = this.$refs.funcTreeSelect.getCheckedNodes();
       if(checkedNodes.length===0){
            this.$alert("请选择一条信息");
       }else{
           if(checkedNodes.length>1){
                this.funcTreeSelect.callback(checkedNodes[checkedNodes.length-1]);
           }else{
                this.funcTreeSelect.callback(checkedNodes[0]);
           }
           
            this.$refs.funcTreeSelect.setCheckedKeys([]);
       }
},
sysMenuOrgan_change:function(fieldName,row){
    HttpApi.updateProvider("sysOrganMenu",fieldName,row,function(){
                        
    });
},
menusInfo_load:function(){
    let that = this;
    HttpApi.queryObject("sysMenus",this.menusInfo.operData,function(res){
        that.menusInfo.data = res;
    });
}
,
sysMenuOrgan_currentChange:function(currentRow){
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.sysMenuOrgan.currentRow = this.$options.data().sysMenuOrgan.currentRow;
    }else{
        this.sysMenuOrgan.currentRow = currentRow;
    }
    this.sysMenuOrgan_operCtrl(currentRow);
},
jsonEditor_initAceEditor:function(param){
    this.jsonEditor.data = ace.edit("jsonEditor",{
						fontSize: 14, // 编辑器内字体大小
						minLines:100,
						showPrintMargin:false,
						showLineNumbers:true,
						showGutter:true,
						enableLiveAutocompletion:true,
						enableSnippets:true,
						enableBasicAutocompletion:true
	});
	this.jsonEditor.data.setTheme("ace/theme/eclipse");
	this.jsonEditor.data.session.setMode("ace/mode/json");
}
,
menusTree_openMenusAdd:function() {
    let that = this;
    this.menusAdd.editorForm = false;
    let param = {};
    this.menusAdd_dialogOpen(param, function(dialogData) {
        HttpApi.post("/platform/menus/save", dialogData, function(res) {
            if (res.parentId == "-1" || res.parentId == "0") {
                that.menusTree.data.push(res);
            } else {
                that.$refs.menusTree.append(res, res.parentId);
            }
            that.menusAdd.visible = false;
        });
    })
},
menusTree_load:function(node, resolve) {
    let that = this;
    if (node) {
        HttpApi.queryArray("sysMenus", {
            "parentId": node.id
        }, function(res) {
            return resolve(res);
        });
    } else {
        HttpApi.post("/platform/menus/menuTree", this.menusTree.operData, function(treeData) {
            that.menusTree.data = treeData;
            if (treeData.length > 0) {
                that.$nextTick(function() {
                    /*that.$refs.menusTree.setCurrentKey(treeData[0].id);
                    that.menusTree_currentChange(treeData[0]);*/
                });
            } else {
                that.menusTree_currentChange();
            }
        });
    }

},
funcTreeSelect_currentChange:function(data,node){
    if(data){
        this.funcTreeSelect.currentNodeKey=data.id;
        this.funcTreeSelect.currentRow=data;
    }else{
        this.$data.funcTreeSelect.currentNodeKey="";
        this.$data.funcTreeSelect.currentRow=this.$options.data().funcTreeSelect.currentRow;
    }
    
},
menusTree_check:function(node,list){

}
,
sysMenuOrgan_delete:function() {
    let that = this;
    let selection = that.$refs.sysMenuOrgan.selection;
    let selLength = selection.length;
    if (selLength == 0) {
        that.$alert("请勾选要操作的数据");
        return;
    }
    HttpApi.delBatchProviderConfirm("sysOrganMenu", selection, function(res) {
        for (let i = 0; i < selLength; i++) {
            let index = that.sysMenuOrgan.data.findIndex(function(item) {
                return item.id == selection[i].id;
            });
            that.sysMenuOrgan.data.splice(index, 1);
        }

        if (that.sysMenuOrgan.data.length == 0) {
            that.$data.sysMenuOrgan.currentRow = that.$options.data().sysMenuOrgan.currentRow;
            that.$refs.sysMenuOrgan.setCurrentRow();
        } else {
            that.$refs.sysMenuOrgan.setCurrentRow(that.sysMenuOrgan.data[0]);
        }
        that.$message.success("删除成功");
    });
},
menusTree_allowDrop:function(draggingNode, dropNode, type) {
    /*拖拽时判定目标节点能否被放置。
    type ：'prev'、'inner' 和 'next'，
    分别表示放置在目标节点前、插入至目标节点和放置在目标节点后*/
    if (draggingNode.data.children && draggingNode.data.children.length > 0) {
        if (draggingNode.data.menuType == "1" && dropNode.data.menuType == "0") {
            return true;
        } else if (draggingNode.data.menuType == "2" && dropNode.data.menuType == "1") {
            return true;
        } else if (draggingNode.data.menuType == dropNode.data.menuType && type != 'inner') {
            return true;
        } else {
            return false;
        }
    } else {
        if (dropNode.data.menuType == "2" && type == 'inner') {
            return false;
        } else {
            return true;
        }
    }
},
menusTree_treeCommand:function(param) {
    let that = this;
    if (param.flag == "addChildren") {
        let dialogParam = {};
        dialogParam.parentId = param.nodeData.id;
        that.menusAdd_dialogOpen(dialogParam, function(dialogData) {
            HttpApi.post("/platform/menus/save", dialogData, function(res) {
                if (res.parentId == "-1") {
                    that.menusTree.data.push(res);
                } else {
                    let parentNode = that.$refs.menusTree.getNode(res.parentId); // 获取获取父节点对象
                    that.$refs.menusTree.append(res, parentNode);
                }
                that.menusAdd.visible = false;
            });
        })
    }
    if (param.flag == "del") {
        HttpApi.postConfirm("/platform/menus/del", param.nodeData, function(res) {
            that.$refs.menusTree.remove(param.nodeData);
            that.menusTree_currentChange();
        });
    }
},
sysMenuOrgan_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.sysMenuOrgan.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.sysMenuOrgan.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       
    }else {
       
    }
},
menusAdd_dialogOpen:function(param,callback){
    this.$data.menusAdd.data = this.$options.data().menusAdd.data;
    this.$data.menusAdd.operData = this.$options.data().menusAdd.operData;
    for(let val in param) {
        this.$set(this.menusAdd.data, val, param[val])
    }
    this.menusAdd.callback=callback;
    this.menusAdd.visible = true;
}
,
jsonEditor_load:function(content){
    let that = this;
	this.$nextTick(function(){
		that.jsonEditor_initAceEditor();
		that.jsonEditor.data.getSession().setValue(content);
	});
}
,
menusTree_nodeDrop:function(draggingNode, dropNode, dropType, ev) {
    let that = this;
    /*共四个参数，依次为：被拖拽节点对应的 Node、结束拖拽时最后进入的节点、
        被拖拽节点的放置位置（before、after、inner）、event	*/
        
    if(dropType=='inner'){
        HttpApi.post("/platform/menus/move", {
            "id": draggingNode.data.id,
            "parentId": dropNode.data.id
        }, function(res) {
            that.$set(draggingNode.data, "parentId", dropNode.data.id);
            that.$set(draggingNode.data, "menuType", res.menuType);
            that.$message.success("移动成功");
        });
    }else{
        if (draggingNode.data.parentId == dropNode.data.parentId) {
            let ids = [];
            let childNodes = dropNode.parent.childNodes;
            let ll = childNodes.length;
            for (let l = 0; l < ll; l++) {
                ids.push(childNodes[l].data.id);
            }
            HttpApi.post("/platform/menus/sort", {
                "ids": ids,
                "parentId": dropNode.data.parentId
            }, function(res) {
                that.$message.success("移动成功");
            });
        }else{
            HttpApi.post("/platform/menus/move", {
                "id": draggingNode.data.id,
                "parentId": dropNode.data.parentId
            }, function(res) {
                that.$set(draggingNode.data, "parentId", dropNode.data.parentId);
                that.$set(draggingNode.data, "menuType", res.menuType);
                that.$message.success("移动成功");
            });
        }
    }
},
menusInfo_editJsonEditor:function() {
    /*没有定义方法模板，需要去定义方法模板*/
    let that = this;
    
     HttpApi.post("/platform/menus/queryParam", this.menusInfo.data, function(res) {
        /*请补充方法信息*/
        that.jsonEditor_dialogOpen(res, function(dialogData) {
            res.content = dialogData;
            HttpApi.post("/platform/menus/saveParam", res, function(res2) {
                that.jsonEditor.visible = false;
            });
        })
    });
},
selectOrgan_operCtrl:function(currentRow) {
    /**
    * operDisabled：控制按钮的是否禁止操作，true代表禁止操作，false代表允许操作
    * this.$set(this.selectOrgan.operDisabled, "buttonE", true);
    * operVisible：控制按钮是否显示，true代表显示，false代表不显示
    * this.$set(this.selectOrgan.operVisible, "buttonE", false);
    */
    if(!currentRow) {
       
    }else {
       
    }
},
selectOrgan_dialogCancel:function(){
     this.selectOrgan.visible = false;
},
jsonEditor_dialogOpen:function(param,callback){
    this.jsonEditor.callback=callback;
    this.jsonEditor.visible = true;
    this.jsonEditor_load(param.content);
}
,
javaEditor_dialogOpen:function(param,callback){
    this.javaEditor.callback=callback;
    this.javaEditor.visible = true;
    this.javaEditor_load(param.content);
}
,
selectOrgan_delete:function() {
    let that = this;
    let selection = that.$refs.selectOrgan.selection;
    let selLength = selection.length;
    if (selLength == 0) {
        that.$alert("请勾选要操作的数据");
        return;
    }
    HttpApi.delBatchProviderConfirm("sysOrgan", selection, function(res) {
        for (let i = 0; i < selLength; i++) {
            let index = that.selectOrgan.data.findIndex(function(item) {
                return item.id == selection[i].id;
            });
            that.selectOrgan.data.splice(index, 1);
        }

        if (that.selectOrgan.data.length == 0) {
            that.$data.selectOrgan.currentRow = that.$options.data().selectOrgan.currentRow;
            that.$refs.selectOrgan.setCurrentRow();
        } else {
            that.$refs.selectOrgan.setCurrentRow(that.selectOrgan.data[0]);
        }
        that.$message.success("删除成功");
    });
},
javaEditor_dialogCancel:function(){
     this.javaEditor.visible = false;
},
selectOrgan_dialogOpen:function(param,callback){
    this.$data.selectOrgan.data = this.$options.data().selectOrgan.data;
    this.$data.selectOrgan.operData = this.$options.data().selectOrgan.operData;
    this.$data.selectOrgan.currentRow = this.$options.data().selectOrgan.currentRow;
    for(let val in param) {
        this.$set(this.selectOrgan.operData, val, param[val])
    }
    this.selectOrgan.callback=callback;
    this.selectOrgan.visible = true;
    this.selectOrgan_load();
}
,
sysMenuOrgan_pageCurrentChange:function(currentPage){
    this.sysMenuOrgan.pagingData.currentPage=currentPage;
    this.sysMenuOrgan_load();
}
,
selectOrgan_load:function() {
    let that = this;
    let param = {};
    param.pagingData = this.selectOrgan.pagingData;
    param.operData = this.selectOrgan.operData;
    HttpApi.queryDs("platformMenu.notAuthOrgan", param, function(res) {
        that.selectOrgan.pagingData = res.pagingData;
        that.selectOrgan.data = res.data;
        if (that.selectOrgan.data.length > 0) {
            that.$refs.selectOrgan.setCurrentRow(that.selectOrgan.data[0]);
            that.selectOrgan_operCtrl(that.selectOrgan.data[0]);
        } else {
            that.$refs.selectOrgan.setCurrentRow();
            that.selectOrgan_operCtrl();
        }
    });
},
javaEditor_initAceEditor:function(param){
    this.javaEditor.data = ace.edit("javaEditor",{
						fontSize: 14, // 编辑器内字体大小
						minLines:100,
						showPrintMargin:false,
						showLineNumbers:true,
						showGutter:true,
						enableLiveAutocompletion:true,
						enableSnippets:true,
						enableBasicAutocompletion:true
	});
	this.javaEditor.data.setTheme("ace/theme/eclipse");
	this.javaEditor.data.session.setMode("ace/mode/java");
}
,
javaEditor_load:function(content){
    let that = this;
	this.$nextTick(function(){
		that.javaEditor_initAceEditor();
		that.javaEditor.data.getSession().setValue(content);
	});
}
,
funcTreeSelect_nodeDrop:function(draggingNode, dropNode, dropType, ev){
	let that = this;
	/*共四个参数，依次为：被拖拽节点对应的 Node、结束拖拽时最后进入的节点、
	    被拖拽节点的放置位置（before、after、inner）、event	*/
	
},
funcTreeSelect_allowDrop:function(draggingNode, dropNode, type){
    /*拖拽时判定目标节点能否被放置。
    type ：'prev'、'inner' 和 'next'，
    分别表示放置在目标节点前、插入至目标节点和放置在目标节点后*/
},
menusAdd_dialogOk:function(){
      let that = this;
      this.$refs.menusAdd.validate(function(valid){
           if(valid){
                that.menusAdd.callback(that.menusAdd.data);
           }else{
                return false;
           }
      });
},
selectOrgan_change:function(fieldName,row){
    HttpApi.updateProvider("sysOrgan",fieldName,row,function(){
                        
    });
},
menusInfo_editFuncTreeSelect:function() {
    /*没有定义方法模板，需要去定义方法模板*/
    let that = this;
    this.funcTreeSelect_dialogOpen({}, function(dialogData) {
        let url = "/" + dialogData.categoryCode + "/" + dialogData.code;
        that.$set(that.menusInfo.data, "url", url);
        that.funcTreeSelect.visible = false;
    })
},
selectOrgan_currentChange:function(currentRow){
    if(!currentRow){
        //如果没有传入值，则将当前的选中值清空
        this.$data.selectOrgan.currentRow = this.$options.data().selectOrgan.currentRow;
    }else{
        this.selectOrgan.currentRow = currentRow;
    }
    this.selectOrgan_operCtrl(currentRow);
},
menusInfo_editJavaEditor:function() {
    /*没有定义方法模板，需要去定义方法模板*/
    let that = this;

    HttpApi.post("/platform/menus/queryCalc", {
        "id": this.menusInfo.data.id
    }, function(res) {
        that.javaEditor_dialogOpen(res, function(dialogData) {
            /*需要完善内容*/
            res.content = dialogData;
            HttpApi.post("/platform/menus/saveCalc", res, function(res2) {
                that.$message.success("保存成功");
                that.javaEditor.visible = false;
            });
        })
    });
},
funcTreeSelect_check:function(node,list){
    if (list.checkedKeys.length >= 2) {
     	//单选实现
     	this.$refs.funcTreeSelect.setCheckedKeys([node.id]);
    }
}
,
menusInfo_change:function(fieldName){
    HttpApi.updateProvider("sysMenus",fieldName,this.menusInfo.data,function(){

    });
},
jsonEditor_dialogCancel:function(){
     this.jsonEditor.visible = false;
},
funcTreeSelect_load:function(node, resolve) {
    let that = this;
    HttpApi.post("/platform/menus/queryFunctions", this.funcTreeSelect.operData, function(treeData) {
        that.funcTreeSelect.data = treeData;
        if (treeData.length > 0) {
            that.$nextTick(function() {
                that.$refs.funcTreeSelect.setCurrentKey(treeData[0].id);
                that.funcTreeSelect_currentChange(treeData[0]);
            });
        } else {
            that.funcTreeSelect_currentChange();
        }
    });

},
funcTreeSelect_dialogOpen:function(param,callback){
    this.$data.funcTreeSelect.data = this.$options.data().funcTreeSelect.data;
    this.$data.funcTreeSelect.operData = this.$options.data().funcTreeSelect.operData;
    for(let val in param) {
        this.$set(this.funcTreeSelect.operData, val, param[val])
    }
    this.funcTreeSelect.callback=callback;
    this.funcTreeSelect.visible = true;
    this.funcTreeSelect_load();
}
,
funcTreeSelect_dialogCancel:function(){
     this.funcTreeSelect.visible = false;
},
menusAdd_dialogCancel:function(){
     this.menusAdd.visible = false;
},
sysMenuOrgan_load:function() {
    let that = this;
    let param = {};
    param.pagingData = this.sysMenuOrgan.pagingData;
    param.operData = this.sysMenuOrgan.operData;
    HttpApi.queryDs("platformMenu.authOrgan", param, function(res) {
        that.sysMenuOrgan.data = res.data;
        that.sysMenuOrgan.pagingData = res.pagingData;
        if (that.sysMenuOrgan.data.length > 0) {
            that.$refs.sysMenuOrgan.setCurrentRow(that.sysMenuOrgan.data[0]);
            that.sysMenuOrgan_operCtrl(that.sysMenuOrgan.data[0]);
        } else {
            that.$refs.sysMenuOrgan.setCurrentRow();
            that.sysMenuOrgan_operCtrl();
        }
    });
},
javaEditor_dialogOk:function(){
     let content = this.javaEditor.data.getSession().getValue();
    this.javaEditor.callback(content);
},
funcTreeSelect_allowDrag:function(node){
    return true;
},
selectOrgan_dialogOk:function(){
      let that = this;
      let selection = that.$refs.selectOrgan.selection;
      let selLength = selection.length;
      if(selLength==0){
          that.$alert("请至少选择一条数据!");
          return;
      }else{
          this.selectOrgan.callback(selection);
      }
},
jsonEditor_dialogOk:function(){
    let content = this.jsonEditor.data.getSession().getValue();
    this.jsonEditor.callback(content);
},
menusTree_allowDrag:function(node){
    return true;
},
menusAdd_load:function(){
    let that = this;
    HttpApi.queryObject("sysMenus",this.menusAdd.operData,function(res){
        that.menusAdd.data = res;
    });
}
,
menusAdd_editFuncTreeSelect:function() {
    /*没有定义方法模板，需要去定义方法模板*/
    let that = this;
    this.funcTreeSelect_dialogOpen({}, function(dialogData) {
        that.menusAdd.data.url = "/" + dialogData.categoryCode + "/" + dialogData.code;
        that.funcTreeSelect.visible = false;
    })
},
menusTree_currentChange: function(data,node){
    if(data){
        this.menusTree.currentNodeKey=data.id;
        this.menusTree.currentRow = data;
        this.menusInfo.editorForm=true;
this.menusInfo.operData.id=data.id;
this.menusInfo_load();
    this.sysMenuOrgan.operData.menuId=data.id;

this.sysMenuOrgan_load();

    }else{
        this.$data.menusTree.currentNodeKey=this.$options.data().menusTree.currentNodeKey;
        this.$data.menusTree.currentRow = this.$options.data().menusTree.currentRow;
        this.$data.menusInfo.operData=this.$options.data().menusInfo.operData;
this.$data.menusInfo.data=this.$options.data().menusInfo.data;
this.$data.sysMenuOrgan.operData=this.$options.data().sysMenuOrgan.operData;
this.$data.sysMenuOrgan.data=this.$options.data().sysMenuOrgan.data;

    }
}
},
            mounted: function(){
    dragControllerLR();
    dragControllerUD();
},
            created: function(){
    let that=this;
    //获取字典信息
    HttpApi.dictOptions(["orgType"],function(res){
        that.dictOptions=res;
    });

    //加载自定义数据字典
    

    //加载初始化load
    this.menusTree_load();


    //加载初始化方法
    
}
    });
    

    
</script>
</html>
